how to check for palindrome in javascript